const path = require('path')

// 解析路径
function resolve(dir) {
  return path.join(__dirname, dir)
}

// 全局mixins.styl样式
function addStyleResource(rule) {
  rule
    .use('style-resource')
    .loader('style-resources-loader')
    .options({
      patterns: [resolve('src/assets/styles/stylus/index.styl')]
    })
}
module.exports = {

  // 打包必须要加的配置
  publicPath: './',
  outputDir: 'dist',
  assetsDir: 'static',
  chainWebpack: config => {
    const types = ['vue-modules', 'vue', 'normal-modules', 'normal']
    types.forEach(type =>
      addStyleResource(config.module.rule('stylus').oneOf(type))
    )
    config.resolve.alias
      .set('styles', resolve('src/assets/styles'))
      .set('images', resolve('src/assets/images'))
      .set('components', resolve('src/components'))
  },

  productionSourceMap: false,


  devServer: {
    port: 9000,
    proxy: {

      '/jeecg-boot': {
        target: 'http://8.134.214.14:8080',
        ws: false,
        changeOrigin: true
      },
    }
  },

  lintOnSave: undefined
}